package team.stride.tabs.records;

import java.util.ArrayList;

import team.stride.database.crud.results.ResultsItem;
import team.stride.database.crud.tracks.TracksItem;

public class ReportTrack
{
	private TracksItem track;
	private ArrayList<ResultsItem> results;

	public ReportTrack(TracksItem track, ArrayList<ResultsItem> results)
	{
		this.track = track;
		this.results = results;
	}

	public TracksItem getTrack()
	{
		return track;
	}

	public void setTrack(TracksItem track)
	{
		this.track = track;
	}

	public ArrayList<ResultsItem> getResults()
	{
		return results;
	}

	public void setResults(ArrayList<ResultsItem> results)
	{
		this.results = results;
	}

	public String toHTMLString()
	{
		String pl = "<h5>" + 
		getFont1("Name: ") + getFont2(track.getName()) + "<br/>" + 
		getFont1("Lenght: ") + getFont2(""+track.getLenght()) + "<br/>" +
		getFont1("Details: ") + getFont2(track.getDetails()) +
		"</h5><ul>";
		for (ResultsItem result : results)
		{
			pl += "<li><h6>" + 
			getFont1("Userame: ") + result.getUsername() + "<br/>"	+ 
			getFont1("Time: ") + result.getTime() + " sec" + "<br/>"	+
			getFont1("Length: ") + result.getLength() + " Km"+ "<br/>"	+
			getFont1("Speed: ") + result.getTopSpeed() + " Km/h"+ "<br/>"	+
			getFont1("Date: ") + result.getStringDate() + "</h6>";
		}
		return pl + "</ul>";
	}
	final static String getFont1(String text)
	{
		return "<font color='#777777'>" + text + "</font>";
	}

	final static String getFont2(String text)
	{
		return "<font color='#fe6700'>" + text + "</font>";
	}
}
